﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;

namespace PWAsker
{
    //An Action holds Executables
    public class Profile
    {

        //private objects
        private int iActiveAction = 0;

        //serialized objects + setter/getter
        private String _ProfileName;
        public String ProfileName
        {
            get { return _ProfileName; }
            set { _ProfileName = value; }
        }
        
        private List<Action> _lActions = new List<Action>();
        public List<Action> lActions
        {
            get { return _lActions; }
            set { _lActions = value; }
        }

        //default constuctor
        public Profile()
        {
            Debug.WriteLine("New profile-object generated. Dump: " + _ProfileName + " ~ Listsize: " + _lActions.Count);
        }

        //parametrized constuctor
        public Profile(String szProfileName)
        {
            _ProfileName = szProfileName;
            Debug.WriteLine("New profile-object generated. Dump: " + _ProfileName + " ~ Listsize: " + _lActions.Count);
        }

        //returns active action
        public int getActiveAction()
        {
            return iActiveAction;
        }

        //adds an executable to the active Action
        public void addExecutable(Executable objExecutable)
        {
            Debug.WriteLine("Adding new executable to Action: " + _lActions.ElementAt(iActiveAction).ActionName);
            _lActions.ElementAt(iActiveAction).add(objExecutable);
        }

        //deletes all executables of the active Action
        public void clearCurrentExecutables()
        {
            lActions[iActiveAction].clear();
        }

        //returns all executables from active action as strings
        public List<String> getCurrentCommands()
        {
            return _lActions[iActiveAction].getCurrentCommands();
        }

        //returns all executables from active action as objects
        public List<Executable> getCurrentExecutables()
        {
            return _lActions[iActiveAction].getCurrentExecutables();
        }

    }
}
